﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using log4net;

namespace GiveAQuiz.Web.Logging
{
  /// <summary>
  /// Static class used to handle logging to Log4Net
  /// </summary>
  public static class Logger
  {
    static ILog _logger;

    static ILog TheLog
    {
      get
      {
        if (_logger == null)
        {
          _logger = LogManager.GetLogger("ROOT");
        }
        return _logger;
      }
    }

    public static void LogException(string msg, Exception ex)
    {
      TheLog.Error(string.Format("{0}: {1}", msg, ex));
    }

    public static void LogException(string msg, params object[] args)
    {
      TheLog.ErrorFormat(msg, args);
    }

    public static void LogInfo(string msg, params object[] args)
    {
      TheLog.InfoFormat(msg, args);
    }

    public static void LogWarning(string msg, params object[] args)
    {
      TheLog.WarnFormat(msg, args);
    }

  }
}
